package org.rc.dto;

import lombok.Data;
import org.rc.entity.DczMember;
import org.rc.entity.User;

import java.util.List;

@Data
public class DczInfoDto {

    private Long id;


    private String name;


    private String loginName;


    private List<DczInfoDto.Member> members;

    public static DczInfoDto getInstance(User user){
        DczInfoDto dczInfoDto = new DczInfoDto();
        dczInfoDto.setId(user.getId());
        dczInfoDto.setName(user.getName());
        dczInfoDto.setLoginName(user.getLoginName());
        return dczInfoDto;
    }


    @Data
    public static class Member{

        private Long id;

        /**
         * 职位  1 组长 2 普通成员
         */
        private Integer post;

        /**
         * 姓名
         */
        private String name;

        /**
         * 手机号
         */
        private String phoneNo;

        public static Member getInstance(DczMember dczMember){
            Member member = new Member();
            member.setId(dczMember.getId());
            member.setName(dczMember.getName());
            member.setPost(dczMember.getPost());
            member.setPhoneNo(dczMember.getPhoneNo());
            return member;
        }
    }
}
